// Playground - noun: a place where people can play

import UIKit

var str = "Hello, playground"

struct Resolution {
    var width = 0
    var height = 0
}

class Video {
    var resolution = Resolution()
    var name:String?
}

var r1 = Resolution(width: 640, height: 480)
//r1.width = 100

var v1 = Video()
v1.name = "name1"
v1.resolution.width = 200

var v2 = v1
v2.name = "name2"

println("width:\(r1.width)")
println("name1:\(v1.name)")

if v1 === v2 {
    println("v1 === v2")
}

struct Point {
    var x = 0.0, y = 0.0
}
struct Size {
    var widht = 0.0, height = 0.0
}
struct Rect {
    var origin = Point()
    var size = Size()
    
    var center:Point {
        get {
            let centerX = origin.x + size.widht * 0.5
            let centerY = origin.y + size.height * 0.5
            return Point(x: centerX, y: centerY)
        }
        
        set(newCenter) {
            origin.x = newCenter.x - size.widht * 0.5
            origin.y = newCenter.y - size.height * 0.5
        }
    }
}
